CREATE VIEW [dbo].[vSoaEvent]
AS
SELECT [Meet_Master].[MEETING] AS [EventId],
'Public' AS [ParentEntityTypeName],
'Public Groups' AS [ParentEntityId],
[Meet_Master].[TITLE] AS [Name],
CAST([Meet_Master].[DESCRIPTION] AS VARCHAR(6000)) AS [Description],
[Meet_Master].[MEETING] AS [CategoryId],
[Meet_Master].[MEETING] AS [CategoryName],
[Meet_Master].[STATUS] AS [Status],
[Meet_Master].[BEGIN_DATE] AS [StartDateTime],
[Meet_Master].[END_DATE] AS [EndDateTime],
[Meet_Master].[MAX_REGISTRANTS] AS [Capacity],
[Meet_Master].[TOTAL_REGISTRANTS] AS [RegistrationsCount],
CAST(CASE WHEN LEN([Meet_Master].[ADDRESS_1]) > 0 THEN [Meet_Master].[ADDRESS_1] + CHAR(13) ELSE '' END +
CASE WHEN LEN([Meet_Master].[ADDRESS_2]) > 0 THEN [Meet_Master].[ADDRESS_2] + CHAR(13) ELSE '' END +
CASE WHEN LEN([Meet_Master].[ADDRESS_3]) > 0 THEN [Meet_Master].[ADDRESS_3] + CHAR(13) ELSE '' END +
CASE WHEN LEN([Meet_Master].[CITY]) > 0 THEN [Meet_Master].[CITY] + ', ' ELSE '' END +
CASE WHEN LEN([Meet_Master].[STATE_PROVINCE]) > 0 THEN [Meet_Master].[STATE_PROVINCE] + ' ' ELSE '' END +
CASE WHEN LEN([Meet_Master].[ZIP]) > 0 THEN [Meet_Master].[ZIP] + ' ' ELSE '' END
AS VARCHAR(200))
AS [FacilityName],
[Meet_Master].[MEETING_IMAGE_NAME] AS [ImageUrl],
CAST(3 AS INT) AS [EventFunctionRegistrationTypeCode],
[Meet_Master].[EARLY_CUTOFF] AS [EarlyCutoffDate],
[Meet_Master].[REG_CUTOFF] AS [RegularCutoffDate],
[Meet_Master].[LATE_CUTOFF] AS [LateCutoffDate],
[Meet_Master].[TOTAL_CANCELATIONS] AS [CancelationsCount],
[Meet_Master].[ADD_GUESTS] AS [CanAddGuests],
[Meet_Master].[REG_OTHERS] AS [AllowRegisterOthers]
FROM [dbo].[Meet_Master]
WHERE [Meet_Master].[WEB_ENABLED] = 1
GO